Compute n-th root of negative numbers where n is odd. (tdf#69293)

Compute expressions like (-8)^(1/3) correctly. This makes
calculations compatible with Excel. Exponents must reduce
to the form 1/n.

Change-Id: I007c818f584323f80f2f6b1000d931f19a4590ad
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index b6d616e..e6ca138 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1654,7 +1654,20 @@
            PushIllegalArgument();
    }
    else
        PushDouble(pow(fVal1,fVal2));
    {
        if (fVal1 < 0 && fVal2 != 0.0)
        {
            int i = (int) (1 / fVal2 + ((fVal2 < 0) ? -0.5 : 0.5));
            if (rtl::math::approxEqual(1 / ((double) i), fVal2) && i % 2 != 0)
                PushDouble(-pow(-fVal1, fVal2));
            else
                PushDouble(pow(fVal1, fVal2));
        }
        else
        {
            PushDouble(pow(fVal1,fVal2));
        }
    }
}

namespace {